trigger Ownerupdate on Account (before insert, before update) {
  List<Decimal> Accid = New List<Decimal>();  
   for(Account a :Trigger.new){         
    Accid.add(a.shortuser__c); } 
  List<user> users = [SELECT ID from user us where (us.shortuser__c = :Accid)];        
    if(users.Size() > 0)          
      {
     for(Account a :Trigger.new){
      a.OwnerId = users[0].ID; }          
        }       
       }